<template>
  <div id="popupbody" v-if="dialogVisible">
    <div class="popupbody-box">
      <div class="popupbody-title">
        <span>{{ cornerDetail.name }}-预约学生详情</span>
        <span class="el-icon-close" @click="closePOpup"></span>
      </div>
      <div class="popupbody-boxin" style="padding:10px;">
        <!--      end-->
        <el-table :data="arryList"
                  height="400"
                  :stripe="tableStyle.tableStripe"
                  :border="tableStyle.tableBorder"
                  tooltip-effect="dark"
                  ref="table">
          <el-table-column label="头像" align="center">
            <template slot-scope="scope">
              <div class="templateImgBox">
                <viewerModle type="1" :imgSrc="scope.row.pic"></viewerModle>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="姓名" prop="name" align="center"></el-table-column>
          <el-table-column label="班级" align="center">
            <template slot-scope="scope">
              {{ scope.row.classes ? scope.row.classes.class_name : '' }}
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
            background
            layout="prev, pager, next"
            :current-page="page.pageindex"
            :total="page.total"
            :page-size="page.pagesize"
            @current-change="handleSizeChange">
        </el-pagination>
      </div>
      <div class="popupbody-footer">
        <el-button type="primary" size="small" @click="closePOpup()">确认</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import {pagination, tableoption} from '@/utils/util.js'

export default {
  name: 'studentMultiple',
  props: ['visible', 'cornerDetail'],
  data() {
    return {
      radio: '',
      dialogVisible: this.visible,
      // 设置table样式
      tableStyle: tableoption,
      // 设置table页面分页所需
      page: {
        pageindex: pagination.pageIndex,
        pagesize: pagination.pageSize,
        total: pagination.total
      },
      arryList: [],
      applyBookBox: {}, // 选中人员信息
      applyBookBoxInit: {}, // 本页面对应对象
      // 搜索
      searchForm: {
      }
    }
  },
  watch: {
    visible() {
      this.dialogVisible = this.visible
      console.log('this.visible:', this.visible)
      if (this.visible) {
        console.log('数据清理选中:', this.dynamicTagsArray)
        this.InitFn()
      }
    }
  },
  created() {
    this.InitFn()
  },
  methods: {
    // 初始化
    async InitFn() {
      this.searchForm.type = 2
      this.searchForm.corner_id = this.cornerDetail.corner_id
      let data = await this.$fetch(this.api.admin_corner_apply_student, this.searchForm)
      this.arryList = data.list.data;
      this.page.total = data.list.total;
    },
    // 搜索
    searchFn(option) {
      this.page.pageindex = 1
      this.searchForm = option
      this.InitFn()
    },
    handleSizeChange(val) {
      this.page.pageindex = val
      this.InitFn()
    },
    // 关闭弹窗
    closePOpup() {
      this.$emit('update:visible', false)
    },
  },
  mounted() {
  }
}
</script>
<style scoped>
.popupbody-boxin {
  min-width: 700px;
}
</style>
